home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / interapplication comm / moreosl / moreprocesses / moreprocesses.h < prev   
Encoding:
C/C++ Source or Header  |  2000-06-23  |  6.8 KB  |  196 lines

  1. /*
  2.     File:        MoreProcesses.h
  3.  
  4.     Contains:    
  5.  
  6.     Written by:    Pete Gontier
  7.  
  8.     Copyright:    Copyright (c) 1998 Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <6>     20/3/00    Quinn   Added MoreProcIsProcessAtFront.  Tidied up some copy and paste
  21.                                     errors in the comments.
  22.          <5>      3/9/00    gaw     API changes for MoreAppleEvents
  23.          <4>      6/3/00    Quinn   Added MoreGetProcessAppFile.
  24.          <3>     1/22/99    PCG     TARGET_CARBON
  25.          <2>    11/11/98    PCG     fix headers
  26.          <1>    11/10/98    PCG     first big re-org at behest of Quinn
  27.  
  28.     Old Change History (most recent first):
  29.  
  30.          <6>    10/11/98    Quinn   Convert "MorePrefix.h" to "MoreSetup.h".
  31.          <5>     11/9/98    PCG     fix comment 4
  32.          <4>     11/9/98    PCG     add copyright blurb
  33.          <3>      9/9/98    PCG     re-work import and export pragmas
  34.          <2>     7/24/98    PCG        coddle linker (C++, CFM-68K)
  35.          <1>     6/16/98    PCG     initial checkin
  36. */
  37.  
  38. #pragma once
  39.  
  40. #include "MoreSetup.h"
  41.  
  42. #include <Processes.h>
  43.  
  44. enum { kSignatureFinder = 'MACS' };
  45.  
  46. #ifdef __cplusplus
  47.     extern "C" {
  48. #endif
  49.  
  50. #pragma import on // for clients
  51. #pragma export on // for building a library
  52. /******************************************************************************
  53.     Return a ProcessSerialNumber for a process whose signature (creator)
  54.     matches the input values.  This routine will find the first process that
  55.     matches the creator.
  56.     
  57.     The ProcessSerialNumber will be kNoProcess is the requested process cannot
  58.     be found. 
  59.  
  60.     pCreator            input:    The creator of the process to be found.
  61.     pPSN                input:    Pointer to a ProcessSerialNumber.
  62.                         output:    A valid PSN or kNoProcess in no match is found.
  63.  
  64.     RESULT CODES
  65.     ____________
  66.     noErr               0    No error
  67.     procNotFound    –600    No process matched specified creator
  68.     ____________
  69. */
  70.  
  71. extern pascal OSStatus MoreProcFindProcessByCreator(const OSType pCreator,ProcessSerialNumber *pPSN);
  72. /******************************************************************************
  73.     Return a ProcessSerialNumber for a process whose signature (type and creator)
  74.     matches the input values.  This routine will find the first process that
  75.     matches the type and creator.
  76.     
  77.     The ProcessSerialNumber will be kNoProcess is the requested process cannot
  78.     be found. 
  79.  
  80.     pCreator            input:    The creator type of the process to be found.
  81.     pType                input:    The file type of the process to be found.
  82.     pPSN                input:    Pointer to a ProcessSerialNumber.
  83.                         output:    A valid PSN or kNoProcess in no match is found.
  84.  
  85.     RESULT CODES
  86.     ____________
  87.     noErr               0    No error
  88.     procNotFound    –600    No process matched specified type and creator
  89.     ____________
  90. */
  91.  
  92. extern pascal OSStatus MoreProcFindProcessBySignature(const OSType pCreator,const OSType pType,ProcessSerialNumber *pPSN);
  93. /******************************************************************************
  94.     Returns the name of the process specified by ProcessSerialNumberPtr.
  95.     
  96.     The string pointed to by pProcessName will be untouched if the process
  97.     can't be found. 
  98.  
  99.     pPSN            input:    The process whose name you want (nil for current)
  100.     pProcessName    input:    Pointer to a Str31 for the process name.
  101.                     output:    The process name.
  102.     
  103.     RESULT CODES
  104.     ____________
  105.     noErr               0    No error
  106.     paramErr         –50    Process serial number is invalid
  107.     ____________
  108. */
  109. extern pascal    OSStatus MoreProcGetProcessName(
  110.                                 const ProcessSerialNumberPtr pPSN,
  111.                                 StringPtr pProcessName);
  112. /******************************************************************************
  113.     Returns information about the process specified by ProcessSerialNumberPtr.
  114.     
  115.     pProcessType and pCreator will be untouched if the process
  116.     can't be found. 
  117.  
  118.     pPSN                input:    The process whose info you want (nil for current).
  119.     pProcessType        output:    The process's type.
  120.     pCreator            output:    The process's signature.
  121.     
  122.     RESULT CODES
  123.     ____________
  124.     noErr               0    No error
  125.     paramErr         –50    Process serial number is invalid
  126.     ____________
  127. */
  128. extern pascal    OSStatus    MoreProcGetProcessTypeSignature(
  129.                         const ProcessSerialNumberPtr pPSN,
  130.                         OSType *pProcessType,
  131.                         OSType *pCreator);
  132. /******************************************************************************
  133.     Returns the FSSpec for the current process
  134.     
  135.     pFSSpec                output:    The process's FSSpec.
  136.     
  137.     RESULT CODES
  138.     ____________
  139.     noErr               0    No error
  140.     paramErr         –50    pFSSpec is nil
  141.     ____________
  142. */
  143. extern pascal OSStatus MoreProcGetCurrentProcessFSSpec(FSSpec *pFSSpec);
  144. /******************************************************************************
  145.     Returns the FSSpec for the process specified by ProcessSerialNumberPtr.
  146.     
  147.     pPSN                input:    The process's whose file you want (nil for current).
  148.     pAppFile            output:    The process's appFile.
  149.     
  150.     RESULT CODES
  151.     ____________
  152.     noErr               0    No error
  153.     paramErr         –50    Process serial number is invalid (or pPSN or pAppFile is nil)
  154.     ____________
  155. */
  156. extern pascal OSStatus MoreProcGetProcessAppFile(const ProcessSerialNumber *pPSN,FSSpec *pAppFile);
  157. /******************************************************************************
  158.     Returns the Process Information for the process specified by pPSN.
  159.     
  160.     pPSN                input:    The process's Serial Number
  161.     pPIR                output:    The process's Information.
  162.     
  163.     RESULT CODES
  164.     ____________
  165.     noErr               0    No error
  166.     paramErr         –50    Process serial number is invalid (or pPSN or pPIR is nil)
  167.     ____________
  168. */
  169. extern pascal OSStatus MoreProcGetProcessInformation(const ProcessSerialNumber *pPSN,ProcessInfoRec *pPIR);
  170. /******************************************************************************
  171.     Returns true if the process specified by pPSN is a background only application.
  172.     
  173.     pPSN                input:    The process's Serial Number
  174.     pIsBOA                output:    The process's Information.
  175.     
  176.     RESULT CODES
  177.     ____________
  178.     noErr               0    No error
  179.     paramErr         –50    Process serial number is invalid (or pPSN or pIsBOA is nil)
  180.     ____________
  181. */
  182. extern pascal OSStatus MoreProcIsProcessBackgroundOnly(const ProcessSerialNumber *pPSN,Boolean *pIsBOA);
  183.  
  184. //*****************************************************************************
  185. // Returns true if the process specified by pPSN is the front process.
  186. // Pass nil to pPSN to test the current process.
  187.  
  188. extern pascal Boolean MoreProcIsProcessAtFront(const ProcessSerialNumber *pPSN);
  189.  
  190. #pragma import reset // for clients
  191. #pragma export reset // for building a library
  192.  
  193. #ifdef __cplusplus
  194.     }
  195. #endif
  196.